<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * detailmaterialin.php
 * @author ranuandra
 *
 * 15 Agu 2011 00:03:15
 *
 * 
 */

class Model_Detailmaterialin extends ORM
{

	protected $_belongs_to = array(
								'material' 		=> array('model' => 'material'),
								'materialin' 	=> array('model' => 'materialin'),
								'location' 		=> array('model' => 'location'),
							);
	
	private $_form = array( 'material_id'		=> '',
							'jumlah'			=> '',
							'materialin_id'		=> '',
							'location_id'		=> '',
							);
							
	private $_field = array(
						'material_id', 'jumlah', 'materialin_id', 'location_id'
					);

	public function rules()
	{
		return array(
			 'material_id' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'jumlah' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'materialin_id' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'location_id' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),

		);
	}
	
	public function get_form()
	{
		return $this->_form;
	}
	
	public function get_field()
	{
		return $this->_field;
	}
	
	public function create_detailmaterialin($values)
	{
		return $this->values($values, $this->_field)->create();
	}
}